/*
 * Copyright 2011-2011 Tiago da Fonseca Frazao  All rights reserved.
 */

package mz.co.research.shared.model;

import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * @author Tiago da Fonseca Frazao
 */
@Entity
@Table(name = "ANSWER_TYPE")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "TYPE", length = 50)
public abstract class AnswerType extends UpdatableEntity {

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 1L;

	// TODO: Deve ser populada a tabela ANSWER_TYPE com os tipos possíveis ( via
	// script )

	@NotNull
	@Column(name = "TYPE", length = 50, nullable = false, insertable = false, updatable = false)
	private String type;

	@NotNull
	@Size(max = 50)
	@Column(name = "DESCRIPTION", length = 100, nullable = false)
	private String description;

	/**
	 * @return the type
	 */
	public String getType() {
		return type;
	}

	/**
	 * @param type
	 *            the type to set
	 */
	public void setType(String type) {
		this.type = type;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description
	 *            the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}

	@Override
	public String toString() {
		StringBuilder buffer = new StringBuilder("\nAnswerType");

		buffer.append(super.toString());

		buffer.append("\ntype        :" + this.type);

		return buffer.toString();
	}
}
